package com.wnxy.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
@Configuration
public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118621667";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCLR58s9nCC+qwklNask/dVME79Tu+tbpWb9I/ywjCNRoHFZJHL7hW4q8WupOFH+rCm2GyC2cNVPIC8k7ocd34TfVkzXVJBSHn1QTdJgbnHJP1fckyJKxE+sJ9WimFVdGzsA05kwwwxl3FhgXOiAVqVWFa1RWrxiNINsERM8SwoJAgX8AsKDNyMKejcJYQ2zh5NP5SLJjI7vZOGeG0x5nLmIuvoV5ztGCASUnYi0yT1+eDJCfaIwSBZ3h39squNEz3Zq2purGGyO6KNQruaTa2kw3BiJtLG2l/wxCwvvTARMb5PV/hLKuN7nLnCkJQ5RO4LN56O7vH5FkvS+7sLCZ4dAgMBAAECggEASN8LQCocSds/j9Az1Y2BPZgN6+iN7C7MphE582h4oKIAKbfptEn4IWv1/N8VY2SdYl4fwAKReZozPPcJy/UVCLtvnTk5XSC/dntNou71tWT8ECEsPCRFXIhqhYvXSy+kAYPlU0Dds2CqGLrzNhMBQtw6WZNdVcwhIrpTsfIJCWKylFOALJFlk0nhVv/2m+7Otp6bUw3yCNb3FEZ+/0wQXbxDykTT01tINVVQCTru+caZGWsk2TMHWjOcQNZHFQu+NXpaSfcxUkSKhrac55JHJgfL7B+GOhBjmoRG8h04GjnvAsnUS5YWOmaAYcmJ8ZCDYKnTPxfs2G/Hfc7WHS8pgQKBgQDLtEycg3wogeyMgrFNcv6EEil+dSN7Pewjnxb9pV7cAGtpKEjfn08aDaajcrDLpv8ZFx6YrNHF+ikVVyOnk77r/ZF23ZT4o/uYAd0fXJVmGBR8lZsz4fR3oem8TAeCo/RpoyohCkAyidNi69OYUPKxp94vLwlFYsb6jIp9WP+3oQKBgQCvCUMxIAnd/G6G3IgJ+E7zq3JKi1YE7DS4Toxc6HMx6hRn2K7iJ4dmqviq0sEHVaR1rIb0fz8AzZlJc6T1Y/ltaFCxiwDLOr+Nv86N+OehcdvQyrDExaBGZvB3NAUJ9NX+JO8+5I9iTU5egRMRhUoZMyH6iHdCu3DY/KGqbe6k/QKBgQCwsAHnnBC8Xf1c3xuFDyJ+UfaVzmrpQgup1hsuBRujfeWsv5l+BgOpmH+atCdvbblE/Q235ebKbzLlZMDzYK6wqS9cR9QoWqwm7C7tPfQEKwzSBz4ooWvXvKQthFDbWvTsD+/B2s9WRsAIxH6zVjs8J1wL1yOWgJgQyIhzMxgTIQKBgDTAPt7EQBUFqa29MsaGbgzjo5sxqOfs4+qTyZuKdoUZfbLaS8JelWDsr+qTf5cdSWYpa7atzqgITmUjlBhcW+SMJp2LPd8Bwo8OukpxNCWksdGX9HQo9yegiGH0bHxWrFNegDfdHBVNJQw4LC4AlJdJoLjnfcG/yb+rS3GYle5lAoGAZagSDOg7Qf+N33h89bnoR0VYbuQTn1FI2DaKrWqTIRw4D4dmJwyLjn1WvLxfnzNG9pyX9MZdfnou+aKnC2ZI2euO5evcCKD3932caYxVoVcB/6uy78c/2joNZ/2ZFmXlJCGs5nHEt/pDeHnKvYyfILGF369RNvjM/nL30PiUtbI=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl74ReynN6UXpDe92+QBLc9zWrTv0d7RK0eOtbJjC+zYVHC587F+F9j9gKg1psS7rwIxuOw3UxMW5TkAfeGA06n/W5B9MubS6DnkOdJYoNvy1XMZzklR9JEVo/YyPWpLehOGTflDiVNJSkbxQeSly5IERTMgLDWRhBHCPz0n+y/JR65fh+S0A7NnjwlzBEdZA/bwz+Fkbal+9aFjsu6qdVZJ49eLSx1iPzC60Bzo0VpfEHkNkB2ICRUjtbYrw8KfTdmhgRERv7MPV18XgJs45ua9ypxMN0ebcBwucR2Xtb9cUAde+nBiaFUhkJLhkBj2tBALvrMq21nka0hpPn7vaXwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://ts4cjd.natappfree.cc/order/pay";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://ts4cjd.natappfree.cc/notify";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

